﻿#region FileHeader
//////////////////////////////////////////////////////////////////////////////////
// Author:                          Hector Llanos
// Date:                            08.27.2010
// FileName:                        CMessages.cs
// Reason:                          all the messages that can be used
//////////////////////////////////////////////////////////////////////////////////
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Objects;
using Base;

namespace MessagingSystem
{

    /////////////////////////////////////////////////////////////////
    //// BASE MESSAGE
    ////////////////////////////////////////////////////////////////
    using MGSID = System.Enum;

    public class CBaseMessage
    {
        public enum Messages { MSG_BASE = 0, MSG_CREATE_BULLET, MSG_DESTORY_BULLET, MSG_DESTORY_ENEMY, MSG_Player1_HEALTH_CHANGE, MSG_Player2_HEALTH_CHANGE, MSG_MAX };

        private MGSID m_nMessageID;

        public int MessageID
        {
            get { return System.Convert.ToInt32(m_nMessageID); }
        }

        public CBaseMessage(MGSID messageID)
        {
            m_nMessageID = messageID;
        }
        ~CBaseMessage()
        {

        }
    }

    /////////////////////////////////////////////////////////////////
    //// FOR CREATING AND DESTORYING BULLETS
    ////////////////////////////////////////////////////////////////
    public class CCreateBulletMessage : CBaseMessage
    {
        private CBase m_pOwner;
        private CBase.type m_pType;

        public CBase.type Type
        {
            get { return m_pType; }
        }
        public CBase Owner
        {
            get { return m_pOwner; }
        }

        public CCreateBulletMessage(CBase pOwner, CBase.type type) : base(Messages.MSG_CREATE_BULLET)
        {
            m_pOwner = pOwner;
            m_pType = type;
        }
        ~CCreateBulletMessage() { }
    }

    public class CDestroyBulletMessage : CBaseMessage
    {
        private CBase m_pBullet;
        public CBase Bullet
        {
            get { return m_pBullet; }
        }

        public CDestroyBulletMessage(CBase pBullet): base(Messages.MSG_DESTORY_BULLET)
        {
            m_pBullet = pBullet;
        }
        ~CDestroyBulletMessage() { }
    }


    /////////////////////////////////////////////////////////////////
    //// FOR DESTORYING ENEMIES
    ////////////////////////////////////////////////////////////////
    public class CDestoryEnemy : CBaseMessage
    {
        private CEnemy m_pEnemy;

        public CEnemy Enemy
        {
            get { return m_pEnemy; }
        }

        public CDestoryEnemy(CEnemy pEnemy) : base(Messages.MSG_DESTORY_ENEMY)
        {
            m_pEnemy = pEnemy;
        }
        ~CDestoryEnemy() { }

    }

    /////////////////////////////////////////////////////////////////
    //// Player1 HEALTH CHANGE!
    ////////////////////////////////////////////////////////////////
    public class CPlayer1HealthChange : CBaseMessage
    {
        private int m_nHealth;
        private int m_nMaxHealth;

        public int Health
        {
            get { return m_nHealth; }
        }
        public int MaxHealth
        {
            get { return m_nMaxHealth; }
            set { m_nMaxHealth = value; }
        }

        public CPlayer1HealthChange(int health, int maxhealth)
            : base(Messages.MSG_Player1_HEALTH_CHANGE)
        {
            m_nHealth = health;
            m_nMaxHealth = maxhealth;
        }
        ~CPlayer1HealthChange() { }

    }

    /////////////////////////////////////////////////////////////////
    //// Player2 HEALTH CHANGE!
    ////////////////////////////////////////////////////////////////
    public class CPlayer2HealthChange : CBaseMessage
    {
        private int m_nHealth;
        private int m_nMaxHealth;

        public int MaxHealth
        {
            get { return m_nMaxHealth; }
            set { m_nMaxHealth = value; }
        }
        public int Health
        {
            get { return m_nHealth; }
        }

        public CPlayer2HealthChange(int health, int maxhealth)
            : base(Messages.MSG_Player2_HEALTH_CHANGE)
        {
            m_nHealth = health;
            m_nMaxHealth = maxhealth;
        }
        ~CPlayer2HealthChange() { }

    }
}
